/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package palma.resources;

import java.sql.Connection;
import java.util.List;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.jooq.DSLContext;
import org.jooq.SQLDialect;
import org.jooq.impl.DSL;
import palma.pojo.RefCustomer;

/**
 *
 * @author nimda
 */
@Path("/ref")
public class ReferenceResource {
    
    Connection conn = null;
    
    public ReferenceResource(Connection conn) {
        this.conn = conn;
    }
    
    @GET
    @Path("member")
    @Produces({ MediaType.APPLICATION_JSON })
    public List<RefCustomer> getRefMemberList() {
         DSLContext create = DSL.using(conn, SQLDialect.MYSQL);
         return create.select().from(DSL.tableByName(RefCustomer.tableName))
                 .fetch()
                 .into(RefCustomer.class);
    }
}
